import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

import '../base/base_app.dart';

/// 创建人： Created by zhaolong
/// 创建时间：Created by  on 2021/9/25.
///
/// gongzhonghao biglead
/// https://study.163.com/instructor/1021409098.htm
/// https://blog.csdn.net/zl18603543572
/// https://www.toutiao.com/c/user/token/MS4wLjABAAAAYMrKikomuQJ4d-cPaeBqtAK2cQY697Pv9xIyyDhtwIM/
///
///
///

//应用入口
void main() {
  ///启动根目录
  runApp(BaseApp(
    homeWidget:  Example409(),
  ));
}

///代码清单 4-16
///lib/code/code4/example_409_gesture_page.dart
///手势识别  双击放大、双指缩放、拖动图片 依赖库使用
class Example409 extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _ExampleState();
  }
}

class _ExampleState extends State<Example409> {

  @override
  Widget build(BuildContext context) {
    return Container();
  }


  ///代码清单 4-8-1
  ///lib/code4/example_409_gesture_page.dart
  ///手势识别[InkWell]的基本使用
  Widget buildInkWell() {
    return  InkWell(
      // radius: 30,//水波纹执行的半径
      borderRadius: BorderRadius.all(Radius.circular(20)),
      splashColor: Colors.grey,//水波纹颜色配制
      //点击事件回调
      onTap: () {
        print("onTap 单击回调");
      },
      //需要设置点击事件的子Widget
      child: Container(
        color: Colors.black38,
        width: 100,
        height: 100,
      ),
    );
  }

  ///代码清单 4-8-2
  ///lib/code4/example_409_gesture_page.dart
  ///通过 [InkWell] 为 [Container]设置点击事件
  ///通过 [Ink] 来添加背景样式
  Widget buildInkWellContainer() {
    return  Material(
      child: Ink(
        color: Colors.blue,
        child:  InkWell(
          //点击事件回调
          onTap: () {},
          //不要在这里设置背景色，否则会遮挡水波纹效果,
          child: buildContainer(),
        ),
      ),
    );
  }

  //常见的UI布局
  Container buildContainer() {
    return new Container(
      width: 300.0,
      height: 50.0,
      //设置child 居中
      alignment: Alignment(0, 0),
      child: Text(
        "登录",
        style: TextStyle(color: Colors.white, fontSize: 16.0),
      ),
    );
  }
}
